package com.example.kspo_enjoysports;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class SpinnerAdapter extends ArrayAdapter<String>{

	ArrayList<String> item_arr;
	Context context;
	
	public SpinnerAdapter(Context context, int resource, ArrayList<String> str_arr) {
		super(context, resource, str_arr);
		// TODO Auto-generated constructor stub
		
		this.context = context;
		this.item_arr = str_arr;
	}
	
	@Override
	public String getItem(int position) {
		// TODO Auto-generated method stub
		return item_arr.get(position);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return item_arr.size();
	}
	
	@Override
	public int getViewTypeCount() {
		// TODO Auto-generated method stub
		return 1;
	}
	
	@Override
	public int getItemViewType(int position) {
		// TODO Auto-generated method stub
		return super.getItemViewType(position);
	}

	@Override
	public View getDropDownView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if (convertView == null) {
            LayoutInflater inflater = LayoutInflater.from(context);
            convertView = inflater.inflate(
            		android.R.layout.simple_spinner_dropdown_item, parent, false);
        }

        TextView tv = (TextView) convertView
                .findViewById(android.R.id.text1);
        tv.setText(getItem(position));
        tv.setTextColor(Color.BLACK);
        tv.setTextSize(25); 
        return convertView;
		
		
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if (convertView == null) {
            LayoutInflater inflater = LayoutInflater.from(context);
            convertView = inflater.inflate(
                    android.R.layout.simple_spinner_item, parent, false);
        }

        TextView tv = (TextView) convertView
                .findViewById(android.R.id.text1);
        tv.setText(getItem(position));
        tv.setTextColor(Color.BLACK);
        tv.setTextSize(12);
        return convertView;
	}
	

	
	

}
